home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3b / signal.z / signal
Encoding:
Text File  |  2002-10-03  |  8.0 KB  |  199 lines

  1.  
  2.  
  3.  
  4. SSSSIIIIGGGGNNNNAAAALLLL((((3333BBBB))))                                                          SSSSIIIIGGGGNNNNAAAALLLL((((3333BBBB))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      signal - simplified software signal facilities (4.3BSD)
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssiiiiggggnnnnaaaallll....hhhh>>>>
  13.  
  14.      iiiinnnntttt ((((****ssssiiiiggggnnnnaaaallll((((iiiinnnntttt ssssiiiigggg,,,, iiiinnnntttt ((((****ffffuuuunnnncccc))))((((iiiinnnntttt,,,, ............))))))))))))((((iiiinnnntttt,,,, ............))));;;;
  15.  
  16.      To use any of the BSD signal routines (_k_i_l_l(3B), _k_i_l_l_p_g(3B),
  17.      _s_i_g_b_l_o_c_k(3B), _s_i_g_n_a_l(3B), _s_i_g_p_a_u_s_e(3B), _s_i_g_s_e_t_m_a_s_k(3B), _s_i_g_s_t_a_c_k(2B),
  18.      _s_i_g_v_e_c(3B)) you must either
  19.  
  20.      1) #define ____BBBBSSSSDDDD____SSSSIIIIGGGGNNNNAAAALLLLSSSS or ____BBBBSSSSDDDD____CCCCOOOOMMMMPPPPAAAATTTT before including <_s_i_g_n_a_l._h>, or
  21.  
  22.      2) specify one of them in the compile command or makefile:
  23.  
  24.           cc -D_BSD_SIGNALS -o prog prog.c
  25.  
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      _s_i_g_n_a_l is a simplified interface to the more general _s_i_g_v_e_c(3B) facility.
  29.  
  30.      A signal is generated by some abnormal event, initiated by a user at a
  31.      terminal (quit, interrupt, stop), by a program error (bus error, etc.),
  32.      by request of another program (kill), or when a process is stopped
  33.      because it wishes to access its control terminal while in the background
  34.      (see _t_e_r_m_i_o(7)).  Signals are optionally generated when a process resumes
  35.      after being stopped, when the status of child processes changes, or when
  36.      input is ready at the control terminal.  Most signals cause termination
  37.      of the receiving process if no action is taken; some signals instead
  38.      cause the process receiving them to be stopped, or are simply discarded
  39.      if the process has not requested otherwise.  Except for the SSSSIIIIGGGGKKKKIIIILLLLLLLL and
  40.      SSSSIIIIGGGGSSSSTTTTOOOOPPPP signals, the _s_i_g_n_a_l call allows signals either to be ignored or
  41.      to cause an interrupt to a specified location.
  42.  
  43.      For a list of valid signal numbers and a general description of the
  44.      signal mechanism, please see _ssss_iiii_gggg_nnnn_aaaa_llll(5).
  45.  
  46.      If _f_u_n_c is SSSSIIIIGGGG____DDDDFFFFLLLL, the default action for signal _s_i_g is reinstated.  If
  47.      _f_u_n_c is SSSSIIIIGGGG____IIIIGGGGNNNN the signal is subsequently ignored and pending instances
  48.      of the signal are discarded.  Otherwise, when the signal occurs further
  49.      occurrences of the signal are automatically blocked and _f_u_n_c is called.
  50.  
  51.      A return from the function unblocks the handled signal and continues the
  52.      process at the point it was interrupted.  Unlike the System V signal
  53.      routine, the handler _f_u_n_c rrrreeeemmmmaaaaiiiinnnnssss iiiinnnnssssttttaaaalllllllleeeedddd after a signal has been
  54.      delivered.
  55.  
  56.      SSSSIIIIGGGGKKKKIIIILLLLLLLL will immediately terminate a process, regardless of its state.
  57.      Processes which are stopped via job control (typically <Ctrl>-Z) will not
  58.      act upon any delivered signals other than SSSSIIIIGGGGKKKKIIIILLLLLLLL until the job is
  59.      restarted.  Processes which are blocked via a _b_l_o_c_k_p_r_o_c system call will
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSIIIIGGGGNNNNAAAALLLL((((3333BBBB))))                                                          SSSSIIIIGGGGNNNNAAAALLLL((((3333BBBB))))
  71.  
  72.  
  73.  
  74.      unblock if they receive a signal which is fatal (i.e., a non-job-control
  75.      signal which they are NOT catching), but will still be stopped if the job
  76.      of which they are a part is stopped.  Only upon restart will they die.
  77.      Any non-fatal signals received by a blocked process will NOT cause the
  78.      process to be unblocked (a call to _u_n_b_l_o_c_k_p_r_o_c(2) or _u_n_b_l_o_c_k_p_r_o_c_a_l_l(2) is
  79.      necessary).
  80.  
  81.      The value of _s_i_g_n_a_l is the previous (or initial) value of _f_u_n_c for the
  82.      particular signal.
  83.  
  84.      After a _f_o_r_k(2) the child inherits all handlers and signal masks, but not
  85.      the set of pending signals.
  86.  
  87.      The _e_x_e_c(2) routines reset all caught signals to the default action;
  88.      ignored signals remain ignored, the blocked signal mask is unchanged and
  89.      pending signals remain pending.
  90.  
  91. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  92.      The previous action is returned on a successful call.  Otherwise, -1 is
  93.      returned and _e_r_r_n_o is set to indicate the error.
  94.  
  95. EEEERRRRRRRROOOORRRRSSSS
  96.      _s_i_g_n_a_l will fail and no action will take place if one of the following
  97.      occur:
  98.  
  99.      [EINVAL]       _S_i_g is not a valid signal number.
  100.  
  101.      [EINVAL]       An attempt is made to ignore or supply a handler for
  102.                     SSSSIIIIGGGGKKKKIIIILLLLLLLL or SSSSIIIIGGGGSSSSTTTTOOOOPPPP.
  103.  
  104.      [EINVAL]       An attempt is made to ignore SSSSIIIIGGGGCCCCOOOONNNNTTTT (by default SSSSIIIIGGGGCCCCOOOONNNNTTTT
  105.                     is ignored).
  106.  
  107. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  108.      kill(3B), sigvec(3B), sigblock(3B), sigsetmask(3B), sigpause(3B),
  109.      setjmp(3), blockproc(2), signal(5).
  110.  
  111. CCCCAAAAVVVVEEEEAAAATTTTSSSS ((((IIIIRRRRIIIIXXXX))))
  112.      4.2BSD attempts to restart system calls which are interrupted by signal
  113.      receipt; 4.3BSD gives the programmer a choice of restart or failed-
  114.      return-with-error via the SSSSVVVV____IIIINNNNTTTTEEEERRRRRRRRUUUUPPPPTTTT flag in _s_i_g_v_e_c or use of the
  115.      _s_i_g_i_n_t_e_r_r_u_p_t library routine.  IRIX provides _o_n_l_y the fail-with-error
  116.      option.  The affected system calls are _r_e_a_d(2), _w_r_i_t_e(2), _o_p_e_n(2),
  117.      _i_o_c_t_l(2), and _w_a_i_t(2).  Refer to the _s_i_g_s_e_t(2) man page for a more
  118.      detailed description of the behavior.
  119.  
  120.      Because 4.3BSD and System V both have _s_i_g_n_a_l system calls, programs using
  121.      4.3BSD's version are actually executing _B_S_D_s_i_g_n_a_l.  This is transparent
  122.      to the programmer except when attempting to set breakpoints in ddddbbbbxxxx; the
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSIIIIGGGGNNNNAAAALLLL((((3333BBBB))))                                                          SSSSIIIIGGGGNNNNAAAALLLL((((3333BBBB))))
  137.  
  138.  
  139.  
  140.      breakpoint must be set at _B_S_D_s_i_g_n_a_l.
  141.  
  142. WWWWAAAARRRRNNNNIIIINNNNGGGG ((((IIIIRRRRIIIIXXXX))))
  143.      The 4.3BSD and System V signal facilities have different semantics.
  144.      Using both facilities in the same program is ssssttttrrrroooonnnnggggllllyyyy ddddiiiissssccccoooouuuurrrraaaaggggeeeedddd and
  145.      will result in unpredictable behavior.
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.